import { apiAxios } from "./requests";

const Alogin = apiAxios("/user/login", "post");
const Alogout = apiAxios("/oauth/logout", "delete");
const ArefToken = apiAxios("/oauth/refresh", "put");

const Afood = {
  page: apiAxios("/foods/page"),
  getById: apiAxios("/foods/getById"),
  random: apiAxios("/foods/random"),
  order: apiAxios("/foods/order"),
  recommend: apiAxios("/product/get_recent?type=recommend"),
};

const Auser = {
  info: apiAxios<Iuser>("/user/info"),
  add: apiAxios("/user/save", "post"),
  register: apiAxios("/user/register", "post"),
  isUser: apiAxios("/user/selectIsUser"),
  auto: apiAxios("/user/auto"),
};

const Aorders = {
  save: apiAxios("/orders/save", "post"),
  list: apiAxios("/orders/self"),
};

const Acomment = {
  page: apiAxios("/comment/v/page"),
  add: apiAxios("/comment/add", "post"),
};

const AfoodCate = {
  page: apiAxios("/category/all_category"),
  categoryDetail: apiAxios("/product/get_cate_pros"),
};

export {
  Alogin,
  Alogout,
  ArefToken,
  Auser,
  Afood,
  Aorders,
  Acomment,
  AfoodCate,
};
